package domain.entities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Paciente entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "paciente", catalog = "bms")
public class Paciente implements java.io.Serializable {

	// Fields

	private Integer id;
	private Set<Visitas> visitases = new HashSet<Visitas>(0);
	private Set<ProtocoloCentro> protocoloCentros = new HashSet<ProtocoloCentro>(
			0);

	// Constructors

	/** default constructor */
	public Paciente() {
	}

	/** full constructor */
	public Paciente(Set<Visitas> visitases,
			Set<ProtocoloCentro> protocoloCentros) {
		this.visitases = visitases;
		this.protocoloCentros = protocoloCentros;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "paciente")
	public Set<Visitas> getVisitases() {
		return this.visitases;
	}

	public void setVisitases(Set<Visitas> visitases) {
		this.visitases = visitases;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "pacientes")
	public Set<ProtocoloCentro> getProtocoloCentros() {
		return this.protocoloCentros;
	}

	public void setProtocoloCentros(Set<ProtocoloCentro> protocoloCentros) {
		this.protocoloCentros = protocoloCentros;
	}

}